<template>
  <div class="upload-file">
    <!-- 上传按钮 -->
    <el-button
      class="upload-file-uploader"
      type="primary"
      @click="importTemplate"
    >
      <slot> 下载模板 </slot>
    </el-button>
  </div>
</template>

<script setup>
const { proxy } = getCurrentInstance();

const props = defineProps({
  modelValue: [String, Object, Array],
  url: [String, Object, Array],
  fullPath: [String, Object, Array],
  // 数量限制
});
function importTemplate() {
  proxy.download(
    props.fullPath || props.url + "importTemplate",
    {},
    `template_${new Date().getTime()}.xlsx`
  );
}
</script>

<style scoped lang="scss">
.upload-file-uploader {
  margin-bottom: 5px;
}
.upload-file-list .el-upload-list__item {
  border: 1px solid #e4e7ed;
  line-height: 2;
  margin-bottom: 10px;
  position: relative;
}
.upload-file-list .ele-upload-list__item-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: inherit;
}
.ele-upload-list__item-content-action .el-link {
  margin-right: 10px;
}
</style>
